{% set tab = '    ' %}
{%- macro render_table(data, indent=0) -%}
    {%- if data is mapping -%}
        {{ render_dic(data, indent+1) }}
    {%- elif data is string -%}
        {{ reader_string(data) }}
    {%- elif data is sequence -%}
        {{ render_list(data, indent+1) }}
    {%- else -%}
        nil
    {%- endif -%}
{%- endmacro -%}

{%- macro render_dic(data, indent=0) -%}
{ {% for key, value in data.items() %}
{{tab * indent }}["{{ key }}"] = 

    {%- if value is mapping -%}
        {{ render_table(value, indent + 1) }}
    {%- elif value is string -%}
        {{ reader_string(value) }}
    {%- elif value is sequence -%}
        {{ render_list(value, indent + 1) }}
    {%- elif value is number -%}
        {{ value }}
    {%- elif value is boolean -%}
        {{ "true" if value else "false" }}
    {%- else -%}
        nil
    {%- endif -%},

{%- endfor %} 
}
{%- endmacro -%}

{%- macro render_list(lst, indent=0) -%}
{ {% for item in lst %}
    {%- if item is mapping -%}
        {{ render_dic(item, indent + 1) }}
    {%- elif item is string -%}
        "{{ item }}"
    {%- elif item is number -%}
        {{ item }}
    {%- elif item is boolean -%}
        {{ "true" if item else "false" }}
    {%- else -%}
        nil
    {%- endif -%},
{%- endfor-%}
}
{%- endmacro -%}

{%- macro reader_string(val) -%}
    "{{ val }}"
{%- endmacro -%}

-- Main table
g_config.{{ name }} = {{ render_table(data, 0) }}
